import React from 'react';

export interface IFlowContext {
  id?: number;
  name?: string;
}

export interface FlowContextType {
  id?: number;
  name?: string;
  setFlow: (flow: IFlowContext) => void;
}

/** 业务上下文 */
export const FlowContext = React.createContext<FlowContextType | undefined>(undefined);

export const useFlowContext = () => {
  const context = React.useContext(FlowContext);
  if (!context) {
    throw new Error('useFlowContext must be used within a FlowProvider');
  }
  return context;
};
